<?php
    $data=$_POST;//数组 一维
    $mysql=mysqli_connect("127.0.0.1",'root','123456','2024','3306');
    if($mysql===false) die("数据库连接失败");
    /*
    $sql="create table abc_u(
        id int primary key auto_increment comment 'ID',
        uname varchar(10) comment '用户姓名',
        emil varchar(30) comment '邮箱',
        pwd varchar(60) comment '密码'
    )";

    if($mysql->query($sql)===true){
        echo "ok";
    }*/

    $query="select * from abc_u where uname="."'".$data['uname']."'";
    $res=$mysql->query($query);
    if($res->num_rows!=0) die("账号已存在了");
    $name="'".$data['uname']."'";
    $emil="'".$data['email']."'";
    $pwd="'".sha1($data['pwd'])."'";

    $sql="insert into abc_u(uname,emil,pwd) values(".$name.",".$emil.",".$pwd.")";

    if($mysql->query($sql)===true){
        echo "<script>alert('注册成功');</script>";
    }else{
        echo "<script>alert('注册失败了');</script>";
    }





